<!doctype html>
<html>

	<head>
		<meta charset="utf-8">
		<title>积分明细</title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<link href="css/mui.css" rel="stylesheet" />
		<link rel="stylesheet" type="text/css" href="css/common.css"/>
		<link rel="stylesheet" type="text/css" href="css/index.css"/>
	</head>
	<body class="bg_ff">
		<header class="mui-bar mui-bar-nav">
		    <a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
		    <h1 class="mui-title">积分明细</h1>
		</header>
		<div class="mui-content bg_ff">
			<div  id="pullrefresh">
		    <div class="code_nav">
		    	<table border="" cellspacing="" cellpadding="" >
		    		<thead>
		    			<tr>
		    			<th>时间</th>
		    			<th>数量</th>
		    			<th>状态</th>
		    			<th>方式</th>
		    		</tr>
		    		</thead>
		    		
		    		<tr>
		    			
		    		</tr>
		    		
		    	</table>
		    </div>
		</div>
		</div>
		
		
	
		
		
		<script src="js/mui.js"></script>
		<script src="js/jquery-1.7.1.min.js" type="text/javascript" charset="utf-8"></script>
		<script src="js/index.js" type="text/javascript" charset="utf-8"></script>
		<script type="text/javascript">
			
			//获取积分列表明细
		　　　var current = 1; //当前页码
		　　　var counter=1; //计数器
			
			function getIntegralDetail(current){
				$('.gif').show()
				$.ajax({
					type:"post",
					url:urlcom + "userCenter/getIntegralDetail",
					async:true,
					dataType:'json',
					data:{
						userId:localStorage.getItem('userId'),
						current:current,
						size:10
					},
					success:function(res){
						$('.gif').hide()
						if(res.code==0){
							current++
							console.log(current)
							var html = '';
							if(res.data.length){
								
							$.each(res.data, function(k,v) {
								html += '<tr>'+
				    			'<td>'+v.addTime+'</td>'
								if(v.isGet==1){
									
				    				html+='<td>+'+v.integral+'</td>'
								}else if(v.isGet ==2){
										html+='<td>-'+v.integral+'</td>'
								}
				    			if(v.state == 1){
				    				html+='<td>已完成</td>'
				    			}else if(v.state == 2){
				    				html+='<td >审核中</td>'
				    			}
				    			
				    			if(v.useType == 1 ||v.useType == 7){
				    					html+='<td >点赞</td>'
				    			}else if(v.useType == 2){
				    				html+='<td >签到</td>'
				    			}else if(v.useType == 3){
				    				html+='<td >回答问题</td>'
				    			}else if(v.useType == 4){
				    				html+='<td >推广APP</td>'
				    			}else if(v.useType == 5){
				    				html+='<td >充值</td>'
				    			}else if(v.useType == 6){
				    				html+='<td >下载图</td>'
				    			}else if(v.useType == 8){
				    				html+='<td >提现</td>'
				    			}
				    		   html+='</tr>'
							});
							$('.code_nav table tbody').append(html)
							 mui('#pullrefresh').pullRefresh().endPullupToRefresh()
							
							}else{
								mui('#pullrefresh').pullRefresh().endPullupToRefresh(true);
								
							}
							
						}
					}
			  })
			}getIntegralDetail(1)
			
				mui.init({
				  pullRefresh : {
					container:'#pullrefresh',//待刷新区域标识，querySelector能定位的css选择器均可，比如：id、.class等
					up  : {
					  style:'circle',
					  height:50,//可选.默认50.触发上拉加载拖动距离
					  auto:false,//可选,默认false.自动上拉加载一次
					  contentrefresh : "正在加载...",//可选，正在加载状态时，上拉加载控件上显示的标题内容
					  contentnomore:'没有更多数据了',//可选，请求完毕若没有更多数据时显示的提醒内容；
					  callback :pullupRefresh //必选，刷新函数，根据具体业务来编写，比如通过ajax从服务器获取新数据；
					}
				  }
				});

				function pullupRefresh(){
					current++
					console.log(current)
					console.log('加载')
					getIntegralDetail(current);
					  
							
				}
			
		</script>
	</body>

</html>
